<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"
    />
    <link
      rel="stylesheet"
      href="https://unpkg.com/nprogress@0.2.0/nprogress.css"
    />
    <script src="https://unpkg.com/nprogress@0.2.0/nprogress.js"></script>
    <style>
      .animate__animated {
        animation-duration: 5s;
      }
    </style>
  </head>
  <body>
    <h1 class="animate__animated animate__flipInX">An animated element</h1>
    <button onclick="changeAnimate('animate__flipInX')">flipInX</button>
    <button onclick="changeAnimate('animate__flipInY')">flipInY</button>
    <button onclick="changeAnimate('animate__rotateInDownLeft')">
      rotateInDownLeft
    </button>
    <button onclick="loadData()">loading</button>
    <script>
      const h1 = document.querySelector("h1");
      function changeAnimate(animateName) {
        h1.className = "";
        setTimeout(() => {
          h1.className = "animate__animated " + animateName;
        }, 2000);
      }
      function loadData() {
        NProgress.start(); // 启动进度条
        setTimeout(() => {
          NProgress.done(); // 结束进度条
        }, 5000);
      }
    </script>
  </body>
</html>
